package com.itheima.hashmap;

import java.util.HashMap;
import java.util.Map;
import java.util.Set;

public class Demo03 {

    public static void main(String[] args) {

        HashMap<String, String> map = new HashMap<>();
        map.put("鹿晗","关晓彤");
        map.put("马蓉","王宝强");
        map.put("张若昀","唐艺昕");
        map.put("张恒","郑爽");
        Set<Map.Entry<String,String>> entries = map.entrySet();
        //遍历 获取到的所有键值对组合
        for (Map.Entry<String, String> entry : entries) {
            //entry
            String key = entry.getKey();
            String value = entry.getValue();
            System.out.println(key+"==="+value);
        }
        System.out.println("==============================");
        map.forEach((k,v)->{
            System.out.println(k+"-------------"+v);
        });
    }
}
